package com.ybkj.o2o.zhuanche.service.impl;

import com.ybkj.o2o.zhuanche.common.query.CarTypeQuery;
import com.ybkj.o2o.zhuanche.entity.CarType;
import com.ybkj.o2o.zhuanche.entity.CarTypeCriteria;
import com.ybkj.o2o.zhuanche.entity.CarTypeRel;
import com.ybkj.o2o.zhuanche.mapper.BaseMapper;
import com.ybkj.o2o.zhuanche.mapper.CarTypeMapper;
import com.ybkj.o2o.zhuanche.service.CarTypeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class DefaultCarTypeService extends AbstractBaseService<CarType, CarTypeCriteria, Long>
    implements CarTypeService {

  @Autowired
  private CarTypeMapper carTypeMapper;

  @Override
  public BaseMapper<CarType, CarTypeCriteria, Long> getMapper() {
    return carTypeMapper;
  }

  @Override
  public int insert(CarType carType) {
    carType.setCreated(new Date());
    carType.setUpdated(new Date());
    return super.insert(carType);
  }

  @Override
  public CarType findByCarTypeId(Long carTypeId, String appKey) {
    return carTypeMapper.findByCarTypeId(carTypeId,appKey);
  }

  @Override
  public List<CarType> findAll(Long companyId, String appKey) {
    return carTypeMapper.selectByCompanyId(companyId,appKey);
  }
  

  @Override
  public int deleteById(Long id, String appKey) {
    
    return carTypeMapper.deleteById(id,appKey);
  }

  @Override
  public List<CarType> findByCarType(String carType, String appKey) { 
    
    return carTypeMapper.findByCarType(carType,appKey);
  }

  @Override
  public List<CarType> findByIds(List<Long> ids) {
    return carTypeMapper.findByIds(ids);
  }


  @Override
  public Long countByCompanyIdV4up(Long companyId, String companyName, String appKey) {
    return carTypeMapper.countByCompanyIdV4up(companyId,companyName,appKey);
  }

  @Override
  public List<CarType> findByParams(CarTypeQuery carTypeQuery) {
    return carTypeMapper.findByParams(carTypeQuery);
  }

  @Override
  public List<CarType> queryCarTypeV4up(CarTypeQuery carTypeQuery) {
    return carTypeMapper.queryCarTypeV4up(carTypeQuery);
  }
  
  @Override
  public Long countByParams(CarTypeQuery carTypeQuery) {
    return carTypeMapper.countByParams(carTypeQuery);
  }

  @Override public List<CarType> findByAreaId(Long areaId, String appKey) {

    return carTypeMapper.findByAreaId(areaId,appKey);
  }

@Override
public int insertCarTypeRel(CarTypeRel carTypeRel) {
	// TODO Auto-generated method stub
	carTypeRel.setCreated(new Date());
	carTypeRel.setUpdated(new Date());
	return carTypeMapper.insertCarTypeRel(carTypeRel);
}

@Override
public List<CarTypeRel> getCarTypeRel(Long carTypeId,String appKey) {
	return carTypeMapper.getCarTypeRel(carTypeId,appKey);
}

@Override
public void deleteRel(Long id,String appKey) {
		carTypeMapper.deleteRel(id,appKey);
}

@Override
public CarType getCarTypeByTypeName(String typeName, String appKey) {
	return carTypeMapper.getCarTypeByTypeName(typeName,appKey);
}

@Override
public List<CarType> getCarTypeByIftaxi(String ifTaxi, String appKey) {
	return carTypeMapper.getCarTypeByIftaxi(ifTaxi,appKey);
}
}
